<template>
	<view class="page">
		<u-navbar title="摄像头" border @leftClick="$utils.back()" placeholder>
		</u-navbar>
		<view class="body">
			<scroll-view style="height: 100%;" scroll-y="true">
				<ezplayer  v-if="accessToken&&code"
					id="ezplayer" :accessToken="accessToken" :url="`ezopen://open.ys7.com/${code}/1/live`"
					@handleError="handleError" plugins="talk,voice,capture,ptz,mirror,privacy" />
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				accessToken: null,
				code:null
			}
		},
		onLoad(op) {
			this.accessToken = uni.getStorageSync('accessToken')
			this.code=op.code
		},
		methods: {
			handleError(e) {
				console.log(e)
			},
			
		}
	}
</script>
<style lang="scss" scoped>
	.page {
		height: 100vh;
		padding-bottom: calc(constant(safe-area-inset-bottom) + 10rpx);
		/* 兼容 iOS 设备 */
		padding-bottom: calc(env(safe-area-inset-bottom) + 10rpx);
		box-sizing: border-box;
		background-color: #f5f5f5;
		display: flex;
		flex-direction: column;
	}

	.body {
		overflow: hidden;
		flex: 1;
	}
</style>